from django.db import models


# Create your models here.
class Category(models.Model):
    """
    产品的种类
    """
    name = models.CharField(max_length=128, verbose_name="名称")
    parent = models.ForeignKey('self', on_delete=models.CASCADE, related_name='children', null=True,
                               blank=True, verbose_name='上级分类')

    class Meta:
        db_table = 't_category'
        verbose_name = '分类'
        verbose_name_plural = verbose_name

    def __str__(self):
        return self.name
